import request from "@/utils/request";
import { stringify } from "qs";
import { toFormData } from "@/utils/utils.jsx";

//获取店铺表格数据;
export async function getTableDataOp(params) {
	return request(`/blade-goods/newSystem/ecStore/newSystemEcStoreList`, {
		method: "post",
		data: params
	});
}

//当前登录用户可见分组列表
export async function gtEcstoregroupList(params) {
	return request(`/blade-goods/ecstoregroup/list?${stringify(params)}`);
}

//保存分组;
export async function ecstoregroupSave(params) {
	return request(`/blade-goods/ecstoregroup/save`, {
		method: "post",
		data: params
	});
}

//修改分组（加入分组）;
export async function ecstoregroupUpdateName(params) {
	return request(`/blade-goods/ecstoregroup/updateName`, {
		method: "post",
		data: params
	});
}

//根据主键逻辑删除分组
export async function ecstoregroupDelete(params) {
	return request(`/blade-goods/ecstoregroup/delete`, {
		method: "post",
		body: toFormData(params)
	});
}

//添至分组
export async function addEcstoregroup(params) {
	return request(`/blade-goods/ecstoregroup/addToGroup`, {
		method: "post",
		data: params
	});
}

//业务类型列表
export async function queryBusinessTypes(params) {
	return request(`/blade-goods/ecStoreOtherSettingsOperationRecord/businessTypes?${stringify(params)}`);
}

//操作类型列表
export async function queryOperationTypes(params) {
	return request(`/blade-goods/ecStoreOtherSettingsOperationRecord/operationTypes?${stringify(params)}`);
}

//店铺设置其他记录分页
export async function queryOtherConfigPage(params) {
	return request(`/blade-goods/ecStoreOtherSettingsOperationRecord/page`, {
		method: "post",
		data: params
	});
}

// 操作人列表
export async function queryUser(params) {
	return request(`/blade-user/user/getUserListByUuid`, {
		method: "post",
		data: params
	});
}

//删除授权店铺
export async function deleteEcStoreOp(params) {
	return request(`/blade-goods/ecstore/deleteEcStore?${stringify(params)}`);
}

//修改店铺售后单下载状态
export async function updateSyncAfterSalesOrderStatus(params) {
	return request(`/blade-goods/newSystem/ecStore/updateSyncAfterSalesOrderStatus`, {
		method: "post",
		data: params
	});
}

//修改店铺同步三方订单和商品数据
export async function updateSyncOrderGoods(params) {
	return request(`/blade-goods/newSystem/ecStore/updateSyncOrderGoods`, {
		method: "post",
		data: params
	});
}

//修改库存同步状态
export async function updateSyncStockStatus(params) {
	return request(`/blade-goods/newSystem/ecStore/updateSyncStockStatus`, {
		method: "post",
		data: params
	});
}

//设置网店标签
export async function updateEcStoreTagOp(params) {
	return request(`/blade-goods/ecstore/updateEcStoreTag`, {
		method: "post",
		body: toFormData(params)
	});
}

//获取寄件地址下拉列表
export async function getSendAddress(params) {
	return request(`/blade-user/useraddress/storeSenderAddress`);
}

//获取系统店铺设置详情
export async function newEcStoreSettingDetail(params) {
	return request(`/blade-goods/newSystem/ecStore/newEcStoreSettingDetail?${stringify(params)}`);
}

//修改店铺设置
export async function updateNewEcStoreSetting(params) {
	return request(`/blade-goods/newSystem/ecStore/updateNewEcStoreSetting`, {
		method: "post",
		data: params
	});
}

//请求授权信息
export async function getAuthMessage(params) {
	return request(`/three-gateway/common/store/getToken`, {
		method: "post",
		data: params
	});
}

//查看快照
export async function querySnapshot(params) {
	return request(`/blade-goods/ecStoreSettingsOperationRecord/snapshot?${stringify(params)}`);
}

//店铺设置记录分页
export async function queryConfigPage(params) {
	return request(`/blade-goods/ecStoreSettingsOperationRecord/page`, {
		method: "post",
		data: params
	});
}

//关闭店铺授权
export async function storeAuthClosed(params) {
	return request(`/blade-goods/ecstore/storeAuthClosed?${stringify(params)}`);
}

//获取授权店铺列表
export async function queryEcPlatformConfigList(params) {
	return request(`/blade-goods/ecPlatformConfig/list`, {
		method: "post",
		data: params
	});
}

//创建导出任务
export async function createExportTask(params) {
	return request(`/blade-log/taskInfo/createExportTask`, {
		method: "post",
		data: params
	});
}

//查询导出记录
export async function queryExportTaskRate(params) {
	return request(`/blade-log/taskInfo/getExportTaskRate?${stringify(params)}`);
}

//下载excel
export async function downLoadFileOp(params) {
	return request(`/blade-log/taskInfo/downLoadFile?${stringify(params)}`);
}

//查询生成系统商品规则配置
export async function generateRulesConfig(params) {
	return request(`/new-goods/generate-rules-config/byUuid?${stringify(params)}`);
}

//查询已授权的平台类型
export async function querySelectPlatformType(params) {
	return request(`/blade-goods/newSystem/ecStore/selectPlatformType`, {
		method: "post",
		data: params
	});
}

//微信视频号小店重新授权
export async function getWeChatShopAgainAuth(params) {
	return request(`/blade-goods/ecstore/getWeChatShopAgainAuth?${stringify(params)}`);
}